#include <iostream>
#include <fstream>
#include <ctime>
using namespace std;

int A[5000];

void sort(int A[])
{
	for (int i = 0; i < 5000; i++)
	{
		for (int j = 4999; j > i; j -= 1)
		{
			if (A[j] < A[j - 1])
			{
				int a = A[j];
				A[j] = A[j + 1];
				A[j + 1] = a;
			}
		}
	}
}
void deystv(string name)
{
	ifstream Fin = ifstream(name);
	for (int i=0; i < 5000; i++)
	{
		Fin >> A[i];
	}
	clock_t t0 = clock();
	sort(A);
	clock_t t_kon = clock();
	int t = t_kon - t0;
	cout << name << " " << t << " " << "milliseconds" << "\n";
}

void main()
{
	deystv("m1_sorted.txt");
	deystv("m2_reverse.txt");
	deystv("m3_shuffle.txt");
}
